Upgrade with-jest-typescript example to next 6.0.0 #4543
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! I ran into an issue using typescript and jest with next 6.0.0. I was able to work through fixing it and I wanted to share my solution back to next.js, by upgrading the with-jest-typescript example to next 6.0.0.
The steps I followed were:
npx babel-upgrade --write
which added babel-core@^7.0.0-bridge.0 to allow jest's babel 6 to play nice with next's babel 7ts-jest
and replace withbabel-jest
to use babel to transform the typescript code, as is done when the dev and production builds runAlso, I removed the
NODE_ENV=test
on the jest task, because jest sets the env to test anyways, and I'm on windows where this code is incorrect. The other option is to usecross-env
but I felt it was simpler to just remove the environment override.To my knowledge, this PR would help on the following issues:
#3663 #4227 #4531 #4528 #4239